package test.thread;

public class App {
	
	public static void main(String[] args) {
		DemoThread t = new DemoThread();
		t.start();
		while(!t.isFlag()) {
			System.out.println();
		}
	}

}

class DemoThread extends Thread {
	
	private volatile boolean flag;
	
	public boolean isFlag() {
		return flag;
	}
	
	public void run() {
		try {
			Thread.sleep(1000);
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
		flag = true;
	}
}
